<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>教师列表</title>
    <style>
        body {
            text-align: center;
            background-color: antiquewhite;
        }

        table {
            margin: 0 auto;
            background-color: #6abb91;
            border-radius: 10px;
        }

        th {
            width: 100px;
            height: 50px;
        }

        tr {
            height: 50px;
        }

        a {
            text-decoration: none;
            color: black;
        }

        .headDiv {
            position: relative;
            height: 50px;
            width: 1100px;
            margin: 0 auto;
        }

        input {
            position: absolute;
            height: 30px;
            border-radius: 10px;
            border: none;
        }

        .searchName {
            left: 0;
        }

        .searchClass {
            left: 200px;
        }

        .searchButton {
            left: 400px;
        }
    </style>
</head>
<body>
<h1>教师列表</h1>

<button>
    <a th:href="@{/student/findAll}">学生列表</a>
</button>
<button>
    <a th:href="@{/teacher/findAll}">教师列表</a>
</button>

<div class="headDiv">
    <form th:action="@{/teacher/findAll}" method="get">
        <input class="searchName" type="text" name="name" placeholder="输入名字">
        <input class="searchClass" type="text" name="sex" placeholder="输入性别">
        <input class="searchButton" type="submit" value="搜索">
    </form>
    <button style="position: absolute;right: 20px;height: 30px;border-radius: 10px;background-color: aqua;border: none">
        <a th:href="@{/teacher/goAddTeacher}">新增</a>
    </button>
</div>

<table>
    <thead>
        <th>ID</th>
        <th>姓名</th>
        <th>性别</th>
        <th style="width: 200px">入职时间</th>
        <th>操作</th>
    </thead>
    <tbody>
        <tr th:each="data : ${dataList}">
            <td th:text="${data.id}">1</td>
            <td th:text="${data.name}">刘朝阳</td>
            <td th:text="${data.sex}">男</td>
            <td th:text="${#dates.format(data.createTime, 'yyyy-MM-dd HH:mm:ss')}">2024-11-18 15:34:09</td>
            <td>
                <button>
                    <a th:href="@{/teacher/goAddTeacher(id=${data.id})}">编辑</a>
                </button>
                <button>
                    <a th:href="@{/teacher/deleteTeacher(id=${data.id})}">删除</a>
                </button>
            </td>
        </tr>
    </tbody>
</table>
</body>
</html>